//
//  ZLPersonalCenterHeaerView.m
//  ZLExamination
//
//  Created by Zheng on 2017/8/10.
//  Copyright © 2017年 Zheng. All rights reserved.
//

#import "ZLPersonalCenterHeaerView.h"

@interface ZLPersonalCenterHeaerView ()

@end

@implementation ZLPersonalCenterHeaerView

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        
        self.image = kIMAGE(@"personal_t_bg");
        self.userInteractionEnabled = YES;
        self.backgroundColor = kMY_BLUE_COLOR;
        
        [self addSubview:self.iconImgv];
        [self addSubview:self.nameLbl];
        [self addSubview:self.cardLbl];
        [self addSubview:self.idLbl];
        [self addSubview:self.division];
        
        [_iconImgv mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(15);
            make.top.mas_equalTo(28);
            make.width.height.mas_equalTo(55);
        }];
        
        [_nameLbl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(_iconImgv.mas_right).offset(12);
            make.top.equalTo(_iconImgv);
        }];
        
        [_cardLbl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(_iconImgv.mas_right).offset(12);
            make.top.equalTo(_nameLbl.mas_bottom);
        }];
        
        [_idLbl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(_nameLbl);
            make.top.equalTo(_cardLbl.mas_bottom);
        }];
        
        [_division mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.mas_equalTo(-15);
            make.top.mas_equalTo(30);
        }];
        
        [self addSubview:self.totalTimeLbl];
        [self addSubview:self.studyTimeLbl];
        
        [_totalTimeLbl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self).multipliedBy(.4);
            make.centerY.mas_equalTo(57.5);
        }];
        
        [_studyTimeLbl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self).multipliedBy(1.3);
            make.centerY.mas_equalTo(57.5);
        }];
    
    }
    return self;
}

- (UILabel *)division {
    if (!_division) {
        _division = [[UILabel alloc] init];
        _division.textColor = [UIColor whiteColor];
        _division.font = kMyFont(13);
    }
    return _division;
}


- (UILabel *)cardLbl {
    if (!_cardLbl) {
        _cardLbl = [[UILabel alloc] init];
        _cardLbl.textColor = [UIColor whiteColor];
        _cardLbl.font = kMyFont(13);
    }
    return _cardLbl;
}

- (UILabel *)nameLbl {
    if (!_nameLbl) {
        _nameLbl = [[UILabel alloc] init];
        _nameLbl.textColor = [UIColor whiteColor];
        _nameLbl.font = kMyFont(15);
    }
    return _nameLbl;
}

- (UILabel *)idLbl {
    if (!_idLbl) {
        _idLbl = [[UILabel alloc] init];
        _idLbl.textColor = [UIColor whiteColor];
        _idLbl.font = kMyFont(13);
    }
    return _idLbl;
}

- (UIImageView *)iconImgv {
    if (!_iconImgv) {
        _iconImgv = [[UIImageView alloc] init];
        _iconImgv.layer.cornerRadius = 27.5;
        _iconImgv.layer.masksToBounds = YES;
        _iconImgv.image = kIMAGE(@"Avatar-sample-12");
    }
    return _iconImgv;
}

- (UILabel *)studyTimeLbl {
    if (!_studyTimeLbl) {
        _studyTimeLbl = [[UILabel alloc] init];
        _studyTimeLbl.textAlignment = NSTextAlignmentCenter;
        _studyTimeLbl.textColor = [UIColor whiteColor];
        _studyTimeLbl.font = kMyFont(14);
    }
    return _studyTimeLbl;
}


- (UILabel *)totalTimeLbl {
    if (!_totalTimeLbl) {
        _totalTimeLbl = [[UILabel alloc] init];
        _totalTimeLbl.textAlignment = NSTextAlignmentCenter;
        _totalTimeLbl.textColor = [UIColor whiteColor];
        _totalTimeLbl.font = kMyFont(14);
    }
    return _totalTimeLbl;
}


@end
